﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace HospitalTracking.Utils
{
    static class Serializer
    {
        public static byte[] Serialize(object obj)
        {
            MemoryStream memorystream = new MemoryStream();
            BinaryFormatter bf = new BinaryFormatter();
            bf.Serialize(memorystream, obj);
            return memorystream.ToArray();
        }

        public static object DeSerialize(byte[] buff)
        {
            MemoryStream memorystream = new MemoryStream(buff);
            BinaryFormatter bf = new BinaryFormatter();
            return bf.Deserialize(memorystream);
        }
    }
}
